Skip to main content

Platform Management

Background

The Platform Management API is useful for Tenant Administration and Management of Poly Lens accounts.

Some examples include tenant name, device user count, device count, and site & room information.

When you're testing the sample queries below, keep in mind that the Lens API Marketplace uses a clientID and clientSecret for Authorization. So even if you have Admin access to multiple tenants (Accounts), you'll only see data results from the tenant your clientID and clientSecret map back to. The GraphQL Playground uses user authentication, so if you're an admin in multiple tenants you'll see data results from those tenants (unless you specifically target a tenantID in your query).

We'll start by running a query to find the tenant ID, name, device user count (memberCount), device count, and room count.

It's important to note that memberCount in this query refers to Tenant Users, i.e., members that have access to the Poly Lens Admin Portal.

Query Tenant Information Using tenants

See this query in the GraphQL Playground

query tenantInfo {
tenants {
id
name
memberCount
deviceCount
roomData {
total
}
}
}

In the sample output below you'll see that the data returned matches the structure of the query - this predictability is one of the benefits of GraphQL. The tenantID is redacted, but take note of your tenantID as you'll need it for the next query.

Sample Output from our Query

{
"data": {
"tenants": [
{
"id": "695xxx-bxxx-4xxx-axxx-1xxxxx",
"name": "DFossDemo",
"memberCount": 15,
"deviceCount": 84,
"roomData": {
"total": 15
}
}
]
}
}

Now that we have the tenantID, we can run a query to return details for Tenant Users. In this instance, Tenant Users refer to Account Members (users with account management access) not Device Users (users associated through a Poly Lens App).

We'll need to pass two variables into the users query params: roles and resourceID

If you've spent time in the ACCOUNT > Manage Accounts > Accounts Members section of the Poly Lens UI, you've likely noticed these roles listed as: Admin, Device Manager, and Guest.

When you're passing these roles into the Lens API, you'll need to use one of the following:

  • admin (Admin)
  • it-admin (Device Manager)
  • user (Guest)
  • device_user (Poly Lens App Users).

The resourceID field is your tenantID.

We'll target Tenant Admins in this query and give it a name that reflects its scope. We're only using a subset of the available fields in Root/users/edge/node - head over to the Lens API Marketplace to see the full list.

Query Tenant Admins Using users

See this query in the GraphQL Playground

query tenantAdmins($params: UserSearchParams!) {
users(params: $params) {
count
edges {
node {
email
email_verified
last_ip
last_login
app_metadata {
info {
authedClients
}
}
}
}
}
}

Variables

{
"params": {
"grants": [
{
"roles": "admin",
"resourceId": "695xxx-bxxx-4xxx-axxx-1xxxxx"
}
]
}
}

This is a sample of the result from the query above (reduced to 1 user for conciseness). You'll notice count returned 6 users - this is because we limited the scope to the admin role.

Sample Output From our Query

{
"data": {
"users": {
"count": 6,
"edges": [
{
"node": {
"email": "danny.reed@poly.com",
"email_verified": true,
"last_ip": "8x.x1xx.1xx.1xx",
"last_login": "2023-01-30T03:52:43.684Z",
"app_metadata": {
"info": {
"authedClients": [
"Poly Lens Desktop",
"RapidAPI Developer Portal",
"Poly Lens",
"GraphQL Playground"
]
}
}
}
}
]
}
}
}

The queries above are just a small subset of the power of the Platform and Management APIs - enough to hopefully get you started with exploring the Poly Lens API Marketplace. We'll be updating this article with more examples over time. If you have specific content requests or questions, reach out to DL-DeveloperSupport@poly.com.